home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / etc / acpi / power.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2008-10-14  |  479b  |  28 lines

  1. #!/bin/bash
  2. # TODO:  Change above to /bin/sh
  3.  
  4. test -f /usr/share/acpi-support/key-constants || exit 0
  5.  
  6. . /etc/default/acpi-support
  7. . /usr/share/acpi-support/power-funcs
  8.  
  9. getState;
  10.  
  11. checkStateChanged;
  12.  
  13. shopt -s nullglob
  14.  
  15. for x in /proc/acpi/ac_adapter/*; do
  16.     grep -q off-line $x/state
  17.  
  18.     if [ $? = 0 ] && [ x$1 != xstop ]; then    
  19.     for SCRIPT in /etc/acpi/battery.d/*.sh; do
  20.         . $SCRIPT
  21.     done
  22.     else
  23.     for SCRIPT in /etc/acpi/ac.d/*.sh; do
  24.         . $SCRIPT
  25.     done
  26.     fi
  27. done
  28.